/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2021 3snic Technologies Co., Ltd */

#ifndef SSS_TOOL_COMM_H
#define SSS_TOOL_COMM_H

#define tool_err(format, ...)	pr_err(format, ##__VA_ARGS__)
#define tool_warn(format, ...)	pr_warn(format, ##__VA_ARGS__)
#define tool_info(format, ...)	pr_info(format, ##__VA_ARGS__)

#define SSS_TOOL_SHOW_ITEM_LEN 32

#define SSS_TOOL_VERSION_INFO_LEN 128

#define SSS_TOOL_EPERM        1       /* Operation not permitted */
#define SSS_TOOL_EIO          2       /* I/O error */
#define SSS_TOOL_EINVAL       3       /* Invalid argument */
#define	SSS_TOOL_EBUSY        4       /* Device or resource busy */
#define SSS_TOOL_EOPNOTSUPP   0xFF    /* Operation not supported */

enum sss_tool_driver_cmd_type {
	SSS_TOOL_GET_TX_INFO = 1,
	SSS_TOOL_GET_Q_NUM,
	SSS_TOOL_GET_TX_WQE_INFO,
	SSS_TOOL_TX_MAPPING,
	SSS_TOOL_GET_RX_INFO,
	SSS_TOOL_GET_RX_WQE_INFO,
	SSS_TOOL_GET_RX_CQE_INFO,
	SSS_TOOL_UPRINT_FUNC_EN,
	SSS_TOOL_UPRINT_FUNC_RESET,
	SSS_TOOL_UPRINT_SET_PATH,
	SSS_TOOL_UPRINT_GET_STATISTICS,
	SSS_TOOL_FUNC_TYPE,
	SSS_TOOL_GET_FUNC_IDX,
	SSS_TOOL_GET_INTER_NUM,
	SSS_TOOL_CLOSE_TX_STREAM,
	SSS_TOOL_GET_DRV_VERSION,
	SSS_TOOL_CLEAR_FUNC_STATS,
	SSS_TOOL_GET_HW_STATS,
	SSS_TOOL_CLEAR_HW_STATS,
	SSS_TOOL_GET_SELF_TEST_RES,
	SSS_TOOL_GET_CHIP_FAULT_STATS,
	SSS_TOOL_NIC_RSVD1,
	SSS_TOOL_NIC_RSVD2,
	SSS_TOOL_NIC_RSVD3,
	SSS_TOOL_GET_CHIP_ID,
	SSS_TOOL_GET_SINGLE_CARD_INF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OL_GET_XSFP_INFO = 0x52,
	SSS_TOOL_DEV_NAME_TEST = 0x53,

	SSS_TOOL_GET_WIN_STAT = 0x60,
	SSS_TOOL_WIN_CSR_READ = 0x61,
	SSS_TOOL_WIN_CSR_WRITE = 0x62,
	SSS_TOOL_WIN_API_CMD_RD = 0x63,

	SSS_TOOL_VM_COMPAT_TEST = 0xFF
};

struct sss_tool_show_item {
	char name[SSS_TOOL_SHOW_ITEM_LEN];
	u8 hexadecimal; /* 0: decimal , 1: Hexadecimal */
	u8 rsvd[7];
	u64 value;
};

struct sss_tool_drv_version_info {
	char ver[SSS_TOOL_VERSION_INFO_LEN];
};

#endif /* _SSS_NIC_MT_H_ */

